using UnityEngine;
using System.Collections;
using Fsm;

public class FsmObject : MonoBehaviour
{
    public float frame;

    FsmStateMachine<FsmObject> machine;

    public FsmStateMachine<FsmObject> StateMachine
    {
        get
        {
            return machine;
        }
    }

    public void Start()
    {
        machine = new FsmStateMachine<FsmObject>(this, null);

        Debug.Log(GetHashCode());

        StartCoroutine(FsmCoroutine());
    }

    IEnumerator FsmCoroutine()
    {
        while(true)
        {
            machine.Update();
            yield return new WaitForSeconds(frame);
        }
    }
}
